import javax.swing.*;
import java.awt.*;

/**
 * @Create: IntelliJ IDEA.
 * @Author: subtlman_ljx
 * @Date: 2022/11/18/21:34
 * @Description:
 */
public class T1 extends JFrame {

    public T1(){
        this.setUndecorated(true);
        setBounds(100,100,500,300);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        Container c=getContentPane();
        c.setLayout(new GridLayout(2,2,10,10));

        JPanel p1=new JPanel();
        p1.setLayout(new GridLayout(1,3,10,10));
        JPanel p2=new JPanel(new BorderLayout());
        JPanel p3=new JPanel(new GridLayout(1,2,10,10));
        JPanel p4=new JPanel(new GridLayout(2,1,10,10));

        /*
         * 添加面板
         */
        p1.setBorder(BorderFactory.createTitledBorder("面板1"));//添加标题边框
        p2.setBorder(BorderFactory.createTitledBorder("面板2"));//添加标题边框
        p3.setBorder(BorderFactory.createTitledBorder("面板3"));//添加标题边框
        p4.setBorder(BorderFactory.createTitledBorder("面板4"));//添加标题边框

        p1.add(new JButton("p1"));//增添按钮
        p1.add(new JButton("p1"));//增添按钮
        p1.add(new JButton("p1"));//增添按钮
        p1.add(new JButton("p1"));//增添按钮

        p2.add(new JButton("p2"),BorderLayout.CENTER);
        p2.add(new JButton("p2"),BorderLayout.SOUTH);
        p2.add(new JButton("p2"),BorderLayout.WEST);
        p2.add(new JButton("p2"),BorderLayout.NORTH);
        p2.add(new JButton("p2"),BorderLayout.EAST);

        p3.add(new JButton("p3"));
        p3.add(new JButton("p3"));

        p4.add(new JButton("p3"));

        c.add(p1);
        c.add(p2);
        c.add(p3);
        c.add(p4);

        setVisible(true);
}

    public static void main(String[] args) {
        new T1();
    }
}
